package com.link.play.fit.ai.ui.vip

import android.os.Bundle
import androidx.activity.addCallback
import com.link.play.fit.ai.R
import com.link.play.fit.ai.RemoteConfig
import com.link.play.fit.ai.base.BaseActivity
import com.link.play.fit.ai.base.goToAc
import com.link.play.fit.ai.databinding.AcVipReminderBinding
import com.link.play.fit.ai.utils.GooglePayUtil.extractAndCalculateDailyPriceToMonth
import org.greenrobot.eventbus.EventBus

class VipReminderAc : BaseActivity<AcVipReminderBinding>(AcVipReminderBinding::inflate) {
    private var formattedPrice = ""

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        onBackPressedDispatcher.addCallback {
            finish()
        }
        binding.flBack.setOnClickListener {
            onBackPressedDispatcher.onBackPressed()
        }
        binding.tvTryFree.setOnClickListener {
            goToAc(VipAc::class.java)
            finish()
        }
        initData()
    }

    private fun initData() {
        formattedPrice = intent.getStringExtra("formattedPrice").toString()
        binding.tvPerYear.text = getString(
            R.string.just_per_year,
            formattedPrice,
            extractAndCalculateDailyPriceToMonth(formattedPrice)
        )
    }
}